package com.example.exam.mapper;

import com.example.exam.pojo.Booktype;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BookTypeMapper {

    @Insert("INSERT INTO booktype (name) VALUES " +
            "(#{name})")
    int insertBookType(Booktype booktype);


    @Update("UPDATE booktype SET name = #{name} WHERE id=#{id}")
    int updateBookType(Booktype booktype);

    @Select("SELECT count(*) FROM booktype  ")
    int countRow();

    @Select("SELECT * FROM Booktype WHERE  id >#{row} LIMIT #{rowNumber} ")
    List<Booktype> selectBookTypeByLimit(Long row, Long rowNumber);

    @Delete("delete table Booktype  where  id = #{id} ")
    int deleteBookType(Long id);
}
